<template>
    <div class="table">
        <div class="container">
<!--            <div class="handle-box" style="text-align: right">-->
<!--                &lt;!&ndash;<el-input v-model="select_word" placeholder="筛选关键词" class="handle-input mr10"></el-input>&ndash;&gt;-->
<!--                &lt;!&ndash;<el-button type="primary" icon="search" @click="search">搜索</el-button>&ndash;&gt;-->
<!--                <el-button type="primary" @click="add" style="">添加充值选项</el-button>-->
<!--            </div>-->
            <el-table :data="tableData" border class="table" ref="multipleTable">
                <el-table-column prop="content" label="内容">
                </el-table-column>
                <el-table-column label="图片">
                    <template slot-scope="scope" >
                        <img  :src="scope.row.img_url + '?x-oss-process=image/resize,w_30,h_30'" @click="showImg(scope.row)">
                    </template>
                </el-table-column>
                <el-table-column prop="create_time" sortable label="举报时间">
                </el-table-column>
                <el-table-column prop="create_user_name" label="创建用户名称">
                </el-table-column>
<!--                <el-table-column label="操作" width="180" align="center" fixed="right">-->
<!--                    <template slot-scope="scope">-->
<!--                        <div>-->
<!--                            <el-button type="text" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>-->
<!--                            <el-button type="text" icon="el-icon-delete" class="red" @click="handleDelete(scope.$index, scope.row)">删除</el-button>-->
<!--                        </div>-->
<!--                    </template>-->
<!--                </el-table-column>-->
            </el-table>
            <!--<div class="pagination">-->
            <!--<el-pagination background @current-change="handleCurrentChange" layout="prev, pager, next" :total="1000">-->
            <!--</el-pagination>-->
            <!--</div>-->
            <div class="block">
                <span class="demonstration"></span>
                <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page.sync="currentPage1"
                    :page-size="pageSize"
                    layout="total, prev, pager, next"
                    :total="totalRow">
                </el-pagination>
            </div>
        </div>

        <!-- 编辑弹出框 -->
<!--        <el-dialog title="道具" :visible.sync="editVisible" width="50%">-->
<!--            <rechargeOptionsAdd :uid="rechargeOptionsId" ref="rechargeOptionsAdd" @done="rechargeOptionsDone"></rechargeOptionsAdd>-->
<!--        </el-dialog>-->
        <!-- 查看图片弹出框 -->
        <el-dialog title="图片" :visible.sync="editVisible" width="60%" top="10%">
            <div><img :src="img" alt="" style="width: 100%;"></div>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        components:{
        },
        name: 'basetable',
        data() {
            return {
                select_word: '',
                tableData: [],
                cur_page: 1,
                multipleSelection: [],
                editVisible: false,

                rechargeOptionsId: '',

                img: '',
                pageSize: 0,
                totalRow: 0,
                currentPage1: 0,
            }
        },
        created() {
            this.getData();
        },
        computed: {
            data() {
            }
        },
        methods: {
            loadopen() {
                this.loading = this.$loading({
                    lock: true,
                    text: 'Loading',
                    spinner: 'el-icon-loading',
                    background: 'rgba(0, 0, 0, 0.2)'
                });
                setTimeout(() => {this.loading.close();}, 5000);
            },
            loadclose() {
                this.loading.close();
            },
            // 查看图片
            showImg(row){
                this.editVisible = true;
                this.img = row.img_url;
            },
            // 获取列表数据
            getData(pageNumber) {
                this.loadopen();
                this.config.post('/housinggestate/report/findPage', {
                    pageNum: pageNumber?pageNumber:1,
                }).then(res=>{
                    this.loadclose();
                    if(res.data.code==='0'){
                        this.tableData = res.data.page.list;
                        this.pageSize = res.data.page.pageSize;
                        this.totalRow = res.data.page.totalRow;
                        this.currentPage1 = res.data.page.pageNumber;
                        // this.tableData = res.data.roleList;
                    }else {
                        this.$message.error(this.config.handleError(res.data));
                    }
                })
            },
            search() {
            },
            // 分页导航
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
                this.getData(val);
            },
            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            // // 启用禁用
            // openClose(row){
            //     // let sta = row.state==='0'?'1':'0';
            //     this.config.post('/admin/recharge/rechargetype/changeStatus', {id: row.id}).then(res=>{
            //         if(res.data.code==='0'){
            //             this.$message.success(res.data.message);
            //             this.getData();
            //         }else {
            //             this.$message.error(this.config.handleError(res.data));
            //         }
            //     })
            // },
            // // 添加
            // add(){
            //     this.editVisible = true;
            //     this.rechargeOptionsId = '';
            //     setTimeout(()=>{
            //         this.$refs.rechargeOptionsAdd.getInfo();
            //     }, 100);
            // },
            // // 编辑等级
            // handleEdit(index, row) {
            //     this.editVisible = true;
            //     this.rechargeOptionsId = row.id;
            //     setTimeout(()=>{
            //         // console.log("走到这了")
            //         this.$refs.rechargeOptionsAdd.getInfo();
            //     }, 100);
            // },
            // handleDelete(index, row) {
            //     this.$confirm('确定删除此充值选项?', '提示', {
            //         confirmButtonText: '确定',
            //         cancelButtonText: '取消',
            //         type: 'warning'
            //     }).then(() => {
            //         this.loadopen();
            //         // console.log(row.id)
            //         this.config.post('/admin/recharge/rechargetype/delete', {id: row.id}).then(res=>{
            //             this.loadclose();
            //             if(res.data.code==='0'){
            //                 this.$message.success(res.data.message);
            //                 this.getData();
            //             }else {
            //                 this.$message.error(this.config.handleError(res.data));
            //             }
            //         });
            //     }).catch(() => {
            //     });
            // },
            // rechargeOptionsDone(str) {
            //     this.editVisible = false;
            //     this.getData();
            // },
            // 保存编辑
            saveEdit() {
            },
        }
    }

</script>

<style scoped>
    .handle-box {
        margin-bottom: 20px;
    }

    .handle-select {
        width: 120px;
    }

    .handle-input {
        width: 300px;
        display: inline-block;
    }
    .del-dialog-cnt{
        font-size: 16px;
        text-align: center
    }
    .table{
        width: 100%;
        font-size: 14px;
    }
    .red{
        color: #ff0000;
    }
</style>
